package com.fc.authentication.core.migrate.dialects;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.sql.Connection;
import java.sql.SQLException;


/**
 * dialect for the hqsl database.
 * 
 * @author Chris
 */
public class HsqlDialect extends AbstractDialect {
    
    private static final Logger LOG = LoggerFactory.getLogger(HsqlDialect.class);

    /**
     * @see Dialect#createVersionTable(Connection, String)
     */
    @Override
    public void createVersionTable(Connection conn, String versionTable) throws SQLException {
        try {
            super.createVersionTable(conn, versionTable);
        } catch (SQLException e ) {
            LOG.debug( "sql exception [{}] occured, assuming it's because of duplicate table creation", e.getMessage() );
        }
    }


    /**
     * @see Dialect#hasVersionTable(Connection, String)
     */
    @Override public boolean hasVersionTable(Connection conn, String version) throws SQLException {
        // for this assume it's always no, and then catch the exception, hsql provides no
        // means to test for table existence.
        return false;
    }

}
